﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Elite
{
    class PNJ
    {
        private static string[] voyelles = new string [] {"A", "E", "I", "O", "U", "Y"};
        private static string[] consonnes = new string[] { "B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Z" };
        
        public static List<string> GenerateNames(Random rndTable)
        {
            var liste = new List<string>();

            for (int i = 0; i < 100000; i++)
            {
                var prenom = "";
                var nom = "";
                var lastLetter = "";

                var nbLettres = rndTable.Next(3, 10);
                for (int j = 0; j < nbLettres; j++)
                {
                    var letter = "";
                    if (voyelles.Contains(lastLetter))
                        letter = consonnes[rndTable.Next(0, consonnes.Count())];
                    else
                        letter = voyelles[rndTable.Next(0, voyelles.Count())];

                    lastLetter = letter;
                    prenom += letter;
                }
                
                nbLettres = rndTable.Next(3, 10);
                for (int j = 0; j < nbLettres; j++)
                {
                    var letter = "";
                    if (voyelles.Contains(lastLetter))
                        letter = consonnes[rndTable.Next(0, consonnes.Count())];
                    else
                        letter = voyelles[rndTable.Next(0, voyelles.Count())];

                    lastLetter = letter;
                    nom += letter;
                }

                liste.Add(prenom + " " + nom);
            }

            var test = liste.Where(x => x.Contains("Eric"));
            return liste;
        }
    }
}
